package com.ridu.project.beshid.repository;

import com.ridu.project.beshid.entity.JifenEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;

@Repository
public interface JifenRepository extends JpaRepository<JifenEntity, Long>,JpaSpecificationExecutor<JifenEntity> {

    @Transactional
    @Query("from JifenEntity c where c.owner.beshId = ?1")
    JifenEntity findByMobile(String mobile);

    @Transactional
    @Query("from JifenEntity c where c.user.username = ?1")
    JifenEntity findByUsername(String username);
}
